package com.example.wzh.rxdemo.rx;

import java.util.function.Predicate;

import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.ObservableSource;
import io.reactivex.rxjava3.core.ObservableTransformer;

/**
 * @author: zhwang37
 * @date: 2021/9/7 18:01
 * @email:zhwang37@iflytek.com
 * @describe:
 */
public class RepeatAccordingResultTransformer<T> implements ObservableTransformer<T, T> {
    Predicate<T> predicate;

    public RepeatAccordingResultTransformer(Predicate<T> predicate) {
        this.predicate = predicate;
    }

    @Override
    public @NonNull ObservableSource<T> apply(@NonNull Observable<T> upstream) {
        return new ObservableRepeatAccordingResult<>(upstream, predicate);
    }
}
